package org.smoozik.app.common.piano;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;

import org.smoozik.services.musictheory.Note;


@SuppressWarnings("serial")
public class PianoKey extends Rectangle {
	Color hitColor = Color.ORANGE;
	Color borderColor = Color.DARK_GRAY;

	// graphical attributes
//	int x;
//	int y;
//	int width;
//	int height;
	Color originalColor;
	boolean fill;

	// music attribute
	Note note;

	// situational attribute
	Color currentColor;

	public PianoKey(Note note, int x, int y, int width, int height,
			Color color) {
		this.note = note;
		this.x = x;
		this.y = y;
		this.width = width;
		this.height = height;
		this.originalColor = color;
		this.currentColor = color;
	}

	public Note getNote() {
		return note;
	}

	public void setNote(Note note) {
		this.note = note;
	}

	public void paint(Graphics g) {
		g.setColor(currentColor);
		g.fillRect(x, y, width, height);
		g.setColor(borderColor);
		g.drawRect(x, y, width, height);
	}

	public void lightKey() {
		this.currentColor = this.hitColor;
	}

	public void unlightKey() {
		this.currentColor = this.originalColor;
	}

}
